package com.kuang.demo04;

import com.kuang.demo02.UserService;
import com.kuang.demo02.UserServiceImpl;

/**
 * @program: springs-study
 * @description:
 * @author: 陈恩涛
 * @create: 2020-07-11 21:53
 **/
public class Client {
    public static void main(String[] args) {
        //真实角色
        UserServiceImpl userService = new UserServiceImpl();

        //代理角色，不存在
        ProxyInvocationHandler proxyInvocationHandler = new ProxyInvocationHandler();

        proxyInvocationHandler.setTarget(userService);//设置需要代理的对象

        UserService proxy = (UserService) proxyInvocationHandler.getProxy();//动态生成代理类

        proxy.query();

    }
}
